package com.raquel.coffeeland;


import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;

public class SplashActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
		
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_splash);
		
		Animation animationLoad= AnimationUtils.loadAnimation(this, R.anim.anim);
		ImageView load= (ImageView) findViewById(R.id.imageView1);
		load.startAnimation(animationLoad);
		
		load.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent myIntent = new Intent (SplashActivity.this, MenuActivity.class);
				startActivity(myIntent);
				SplashActivity.this.finish();
			}
			
		});
		
		animationLoad.setAnimationListener(new AnimationListener(){
			public void onAnimationEnd(Animation animation){
				Intent myIntent = new Intent (SplashActivity.this, MenuActivity.class);
				startActivity(myIntent);
				SplashActivity.this.finish();
				
			}
			
			@Override
			public void onAnimationRepeat(Animation arg0) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onAnimationStart(Animation arg0) {
				// TODO Auto-generated method stub
				
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.splash, menu);
		return true;
	}

}
